package thread;

import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

/**
 * Created by User on 2017/12/20.
 */
public class OSCQ {
    static Queue<String> que = new ArrayDeque<String>();
    public static void main(String args[]) {
        Thread1 thread = new Thread1();
        thread.start();
        Scanner sc = new Scanner(System.in);
        while(true) {

            String str = sc.nextLine();
            que.add(str);
        }
    }
    static class Thread1 extends Thread{
        public void run() {
            for(;;) {
                if(que.isEmpty() == false) {
                    System.out.println(que.poll());
                }
            }
        }
    }
}
